home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_bas / pbc32.zip / PBC$BAS.ZIP / REPLACST.BAS < prev    next >
BASIC Source File  |  1996-04-10  |  878b  |  25 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |   PBClone  (C) Copyright 1996 Charon Software, All Rights Reserved   |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. SUB ReplaceString (St$, Old$, New$, Found%, ErrCode%)
  8.    Found% = 0
  9.    IF LEN(Old$) THEN
  10.       ErrCode% = 0
  11.       IF Old$ <> New$ THEN
  12.          tmp% = INSTR(St$, Old$)
  13.          IF tmp% THEN
  14.             DO
  15.                St$ = LEFT$(St$, tmp% - 1) + New$ + MID$(St$, tmp% + LEN(Old$))
  16.                tmp% = INSTR(tmp% + LEN(New$), St$, Old$)
  17.             LOOP WHILE tmp%
  18.             Found% = -1
  19.          END IF
  20.       END IF
  21.    ELSE
  22.       ErrCode% = -1
  23.    END IF
  24. END SUB
  25.